1674A - Number Transformation - CodeForces Solution


constructive algorithms math *800

Please click on ads to support us..

Python Code:

t=int(input())
for i in range(t):
    z=input()
    x=int(z.split()[0])
    y=int(z.split()[1])
    if y%x==0: print(1,y//x)
    else: print(0,0)

C++ Code:

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);  
#define ll long long  
#define dv vector<ll> 
#define dvp vector<pair<ll,ll>>  
#define loop(n) for (ll i = 0; i < n; i++) 
#define input(n,v) loop(n) { ll in; cin >> in; v.push_back(in);}  
#define inputvp(n,v) loop(n) {ll x,y; cin>>x>>y; v.push_back(make_pair(x,y));} 
#define all(v) v.begin(), v.end() 
#define sz(s) s.size()  
#define chk(v) for (auto& i : v)cout << i <<" "; cout<<"\n"
#define dm map<ll,ll>
#define ds set<ll>
#define fi first
#define se second 
using namespace std;
int main()
{
    fast;
    ll t = 0; cin >> t;
    while (t--)
    {
        ll x = 0, y = 0; cin >> x >> y;
        if ((y / x) * x == y)cout << 1 << " " << y / x << "\n";
        else cout << "0 0\n";


    }


}


Comments

Submit
0 Comments
More Questions

122A - Lucky Division
1611C - Polycarp Recovers the Permutation
432A - Choosing Teams
758A - Holiday Of Equality
1650C - Weight of the System of Nested Segments
1097A - Gennady and a Card Game
248A - Cupboards
1641A - Great Sequence
1537A - Arithmetic Array
1370A - Maximum GCD
149A - Business trip
34A - Reconnaissance 2
59A - Word
462B - Appleman and Card Game
1560C - Infinity Table
1605C - Dominant Character
1399A - Remove Smallest
208A - Dubstep
1581A - CQXYM Count Permutations
337A - Puzzles
495A - Digital Counter
796A - Buying A House
67A - Partial Teacher
116A - Tram
1472B - Fair Division
1281C - Cut and Paste
141A - Amusing Joke
112A - Petya and Strings
677A - Vanya and Fence
1621A - Stable Arrangement of Rooks